package com.ling.sbbyyds.mapper.comment;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ling.sbbyyds.entity.comment.Comment;
import com.ling.sbbyyds.interaction.dto.CommentDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 文章评论表(SbbComment)表数据库访问层
 *
 * @author ling
 * @since 2022-07-23 17:48:18
 */
@Repository
public interface SbbCommentMapper extends BaseMapper<Comment> {


    /**
     * 获取帖子的评论列表
     *
     * @param postsId
     * @return
     */
    List<CommentDto> queryCommentsByPostsId(@Param("postsId") Long postsId);


    Integer queryCommentsByPostsIdCount(@Param("postsId") Long postsId);


    /**
     * 获取去帖子的评论
     *
     * @param postsId  帖子id
     * @param level    等级 > 0 查二级及以上的
     * @param parentId 父评论id
     * @return
     */
    List<CommentDto> queryReplyByPostsId(Long postsId, Integer level, Long parentId);
}

